package co.fitstart.admin.service;

import java.text.ParseException;
import java.util.Date;
import java.util.List;
import java.util.Map;

import com.demo2do.core.support.Page;
import com.demo2do.core.support.Result;

import co.fitstart.admin.entity.course.ExperienceStat;
import co.fitstart.admin.entity.search.CourseRoundFeedbackSearch;
import co.fitstart.admin.entity.search.CourseRoundSearch;
import co.fitstart.admin.entity.security.Login;
import co.fitstart.entity.course.CourseType;
import co.fitstart.entity.course.round.CourseRound;
import co.fitstart.entity.course.round.CourseRoundFeedback;
import co.fitstart.entity.course.round.CourseRoundResult;
import co.fitstart.entity.course.round.RoundStatus;
import co.fitstart.entity.course.schedule.CourseSchedule;
import co.fitstart.entity.courseware.fitnessgroup.FitnessGroup;
import co.fitstart.entity.order.Order;
import co.fitstart.entity.principal.Principal;
import co.fitstart.entity.site.Site;
import co.fitstart.entity.user.Student;

/**
 * 
 * @author Administrator
 *
 */
public interface CourseRoundService {
    
    /**
     * 
     * @return
     */
    public int countLastCourseNull();
    
    /**
     * 
     */
    public void updateLastCourse();
    
    /**
     * 
     * @param limit
     */
    public void updateLastCourse(int limit);

    /**
     * List all offline (individual / group / year) course round by site
     * 
     * @param site
     * @return
     */
    public Map<String, List<CourseRound>> listCourseRound(Site site);

    public List<CourseRound> listOfflineCourseRound(Site site);

    /**
     * 
     * @param site
     * @param roundStatus
     * @param courseType
     * @param experience
     * @param give
     * @param page
     * @return
     */
    public List<CourseRound> list(Site site, RoundStatus roundStatus, CourseType courseType, boolean experience,
           boolean give, Page page);

    /**
     * 
     * @param sites
     * @param roundStatus
     * @param courseType
     * @param experience
     * @param give
     * @param page
     * @return
     */
    public List<CourseRound> list(List<Site> sites, RoundStatus roundStatus, CourseType courseType, boolean experience,
           boolean give, Page page);
    
    /**
     * 
     * @param site
     * @param roundStatus
     * @param courseType
     * @param page
     * @return
     */
    public List<CourseRound> list(Site site, RoundStatus roundStatus, CourseType courseType, Page page);
    
    /**
     * 
     * @param sites
     * @param roundStatus
     * @param courseType
     * @param page
     * @return
     */
    public List<CourseRound> list(List<Site> sites, RoundStatus roundStatus, CourseType courseType, Page page);

    /**
     * Load courseRound by id
     * 
     * @param courseRoundId
     * @return
     */
    public CourseRound loadCourseRound(Long courseRoundId);

    /**
     * Load courseRound by order
     * 
     * @param order
     * @return
     */
    public CourseRound loadCourseRound(Order order);

    /**
     * list courseRound by student, courseType
     * 
     * @param student
     * @param courseTypes
     * @return
     */
    public List<CourseRound> listCourseRound(Student student, CourseType[] courseTypes);

    /**
     * edit course schedule time
     * 
     * @param courseSchedules
     * @param day
     * @param hour
     * @param type
     */
    public void changeScheduleTime(List<CourseSchedule> courseSchedules, Date day, String hour, CourseType type);

    /**
     * 
     * @param courseRound
     * @param holdMonth
     */
    public void toggleFreeze(CourseRound courseRound, Integer holdMonth);
    
    /**
     * 
     * @param courseRound
     * @param days
     */
    public void toggleFreezeByDay(CourseRound courseRound, Integer days);

    /**
     * 
     * @param courseRound
     * @param effectiveEnd
     */
    public void editExpiryTime(CourseRound courseRound, Date effectiveEnd);

    /**
     * 
     * @param courseSchedule
     * @param coach
     * @param day
     * @param hour
     * @param site
     */
    public void validateEditSchedule(CourseSchedule courseSchedule, Principal coach, Date day, String hour, Site site);

    /**
     * 
     * @param coach
     * @param dayhour
     * @return
     */
    public Result validateCoach(Principal coach, String dayhour);

    /**
     * 
     * @param coach
     * @param dayhours
     * @param thisDayhour
     * @param selectDayhour
     * @return
     */
    public boolean validateCoach(Principal coach, List<String> dayhours, String thisDayhour, String selectDayhour);

    /**
     * 
     * @param courseSchedule
     * @param day
     * @param hour
     */
    public void validateYearCourse(CourseSchedule courseSchedule, Date day, String hour);

    /**
     * 
     * @param dayhour
     * @return
     */
    public List<String> getDayhours(String dayhour);

    /**
     * 
     * @param courseRound
     */
    public void stopCamp(CourseRound courseRound);

    /**
     * 
     * @param courseRound
     * @param effectiveEnd
     * @param operator
     */
    public void delay(CourseRound courseRound, Date effectiveEnd, Login operator);
    
    /**
     * 
     */
    public void delayAllBYCovid() throws ParseException;

    /**
     * 
     * @param courseRound
     */
    public void activate(CourseRound courseRound);

    /**
     * 
     * @param courseRound
     * @param site
     * @param coach
     */
    public void changeSite(CourseRound courseRound, Site site, Principal coach);

    /**
     * 
     * @param roundCode
     * @param groupName
     * @param fitnessGroup
     * @param tagIds
     */
    public void batchChangeGroup(String roundCode, String groupName, FitnessGroup fitnessGroup, String tagIds);

    /**
     * 
     * @param courseRound
     * @param fitnessGroup
     * @param tagIds
     */
    public void changeGroup(CourseRound courseRound, FitnessGroup fitnessGroup, String tagIds);

    /**
     * 
     * @param courseRound
     * @param fitnessGroup
     */
    public void editGroup(CourseRound courseRound, FitnessGroup fitnessGroup);

    /**
     * 
     * @param courseRound
     * @param tagIds
     */
    public void editTag(CourseRound courseRound, String tagIds);

    /**
     * 
     * @param order
     * @param coach
     * @param site
     * @param experienceStat
     * @return
     */
    public boolean addExperienceCourse(Order order, Principal coach, Site site, ExperienceStat experienceStat);

    /**
     * 
     * @param courseSchedule
     */
    public void cancelExperienceCourse(CourseSchedule courseSchedule);

    /**
     * 
     * @param courseRound
     */
    public void honesty(CourseRound courseRound);
    
    /**
     * 
     * @param courseRoundSearch
     * @param page
     * @return
     */
    public List<CourseRound> search(CourseRoundSearch courseRoundSearch, Page page);
    
    /**
     * @param courseRoundSearch
     * @return
     */
    public int totalCourseRound(CourseRoundSearch courseRoundSearch);
    
    /**
     * 
     * @param coach
     * @param site
     * @param day
     */
    public void validateCoachSite(Principal coach, Site site, Date day);

    /**
     * 
     * @param site
     * @param handled
     * @param page
     * @return
     */
    public List<CourseRoundFeedback> listCourseRoundFeedback(Site site, Boolean handled, Page page);

    /**
     * 
     * @param sites
     * @param handled
     * @param page
     * @return
     */
    public List<CourseRoundFeedback> listCourseRoundFeedback(List<Site> sites, Boolean handled, Page page);

    /**
     * 
     * @param feedbackId
     * @return
     */
    public CourseRoundFeedback loadCourseRoundFeedback(Long feedbackId);

    /**
     * 
     * @param feedback
     * @param remark
     * @param handler
     */
    public void handle(CourseRoundFeedback feedback, String remark, Principal handler);

    /**
     * 
     * @param search
     * @param page
     * @return
     */
    public List<CourseRoundFeedback> search(CourseRoundFeedbackSearch search, Page page);

    /**
     * 
     * @param search
     * @return
     */
    public List<CourseRoundFeedback> search(CourseRoundFeedbackSearch search);

    /**
     * 
     * @param courseRound
     * @return
     */
    public CourseRoundResult loadCourseRoundResult(CourseRound courseRound);
    
    public List<CourseRound> listAll(Student student);

    /**
     * 主课程
     * @param student
     * @return
     */
    public List<CourseRound> listMain(Student student);

    /**
     * 
     * @param student
     * @param site
     * @return
     */
    public List<CourseRound> listMain(Student student, Site site);

    /**
     * 
     * @param student
     * @param sites
     * @return
     */
    public List<CourseRound> listMain(Student student, List<Site> sites);

    /**
     * 绑定主课程(仅赠课)
     * @param give 赠课
     * @param main 主课程
     */
    public void bindMain(CourseRound give, CourseRound main);

    /**
     * 解绑主课程
     * @param give
     */
    public void unbindMain(CourseRound give);

    /**
     * 初始化线上计划（仅root可操作）
     * @param courseRound
     */
    public void rootInitCourseware(CourseRound courseRound);
    
    public List<CourseRound> listOccuredExperience(String mobile);
    
    public List<CourseRound> listOccuredMain(String mobile);
}
